'use strict';
// 品牌表
module.exports = app => {
  const { BOOLEAN, STRING, INTEGER } = app.Sequelize;

  const MallBrand = app.model.define('mall_brand', {
    category_id: {
      type: INTEGER,
      allowNull: false,
      comment: '类目的ID，品牌属于哪个类目下',
    },
    name: {
      type: STRING,
      allowNull: false,
      comment: '品牌名称',
    },
    logo: {
      type: STRING,
      comment: '品牌logo标识',
    },
    desc: {
      type: STRING,
      comment: '品牌描述',
    },
    url: {
      type: STRING,
      comment: '品牌链接',
    },
    status: {
      type: BOOLEAN,
      allowNull: false,
      defaultValue: 1,
      comment: '品牌状态是否启用 1 true ｜ 0 false',
    },

  });

  MallBrand.associate = () => {
    app.model.MallBrand.belongsTo(app.model.MallCategory, { foreignKey: 'category_id' });
  };

  return MallBrand;
};
